﻿<!DOCTYPE html>
<html lang="en">
<nav th:replace="shop/include::shopHeader"></nav>

<body class="shopping_cart_page">
   <nav th:replace="shop/include::shopTop"></nav>
  
  <!-- Main Container -->
  <section class="main-container col1-layout">
    <div class="main container">
      <div class="col-main">
        <div class="cart">
          <div class="page-content page-order"><div class="page-title">
            <h2>现金积分支付</h2>
          </div>
            <div class="order-detail-content">
              <div class="table-responsive">
					<div class="modal-body form-horizontal formline">
						<div class="form-group" hidden="hidden">
							<label class="col-sm-4 control-label" for="model_id">编号</label>
							<div class="col-sm-8">
								<input type="text" class="form-control" id="model_id"
									   placeholder="编号" th:value="${orderInfo.id}">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-4 control-label" for="model_orderNo_id">订单编号</label>
							<div class="col-sm-8">
								<input type="text" class="form-control" id="model_orderNo_id"
									   th:value="${orderInfo.orderNo}" disabled="disabled">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-4 control-label" for="cash_balance_str_id">现金积分余额</label>
							<div class="col-sm-8">
								<input type="text" class="form-control" id="cash_balance_str_id"
									   th:value="${cashPointBalanceStr}" disabled="disabled">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-4 control-label" for="pay_pwd_id">交易密码</label>
							<div class="col-sm-8">
								<input type="password" class="form-control" id="pay_pwd_id" placeholder="请输入交易密码">
							</div>
						</div>
					</div>
					<div class="modal-group">
						<div class="form-group">
							<div class="col-sm-8">
							</div>
							<div class="col-sm-4">
								<button type="button" class="btn btn-primary" id="model_pay_btn_id">支付</button>
							</div>
						</div>
					</div>
              	
              </div>
              <div class="cart_navigation"> 
              	<a class="continue-btn" href="/shop/home"><i class="fa fa-arrow-left"> </i>&nbsp; 返回继续购物</a> 
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>
   <!-- Footer -->
  <nav th:replace="shop/include::shopFooter"></nav>
<!-- End Footer --> 
<!-- JS --> 
<!-- jquery js --> 
<script type="text/javascript" src="/shop/js/jquery.min.js"></script> 
<!-- bootstrap js --> 
<script type="text/javascript" src="/shop/js/bootstrap.min.js"></script> 
<!-- owl.carousel.min js --> 
<script type="text/javascript" src="/shop/js/owl.carousel.min.js"></script> 
<!-- bxslider js --> 
<script type="text/javascript" src="/shop/js/jquery.bxslider.js"></script> 
<!-- megamenu js --> 
<script type="text/javascript" src="/shop/js/megamenu.js"></script> 
<script type="text/javascript">
  /* <![CDATA[ */   
  var mega_menu = '0';
  /* ]]> */
</script> 
<!-- jquery.mobile-menu js --> 
<script type="text/javascript" src="/shop/js/mobile-menu.js"></script>
<!--jquery-ui.min js --> 
<script type="text/javascript" src="/shop/js/jquery-ui.js"></script> 
<!-- main js --> 
<script type="text/javascript" src="/shop/js/main.js"></script> 
<script type="text/javascript" src="/js/plugins/layer/layer.js"></script>
<script type="text/javascript">

function loadShoppingCartNum(){
	$.ajax({
		type : "GET",
		url : "/shop/shopping_cart/total_number",
		sync:false,
		data : {},// 你的formid
		contentType:"application/json",
        dataType : "json",
		success : function(r) {
			if (r.code == 0) {
				$("#shoppingCartNum").html("共"+r.msg+"件商品");
			} else {
				layer.msg(r.msg);
			}
		}
	});
}
loadShoppingCartNum();


$(function () {
	$("#model_pay_btn_id").click(function () {
        var payPwd = $("#pay_pwd_id").val();
        var orderId = $("#model_id").val();
        if(!payPwd){
            alert('支付密码不能为空！');
            return;
        }
        var data = {"orderId":orderId,"payPwd":payPwd};
        $.ajax({
            type: "POST",
            url: "/shop/cash_pay",
            data: JSON.stringify(data),
            dataType: "json",
            contentType:"application/json;charset=utf8",
            success: function(res){
                if(res.code==0){
                    // 提交成功
                    alert('提交成功');
                    window.location.href="/shop/order/list";
                }else{
                    alert('提交失败，'+res.msg)
                };
            },
            complete:function(){
                isajax = false;
            }
        });
		
    })
})


</script>
 
</body>
</html>
